package com.xsz.repository;


import com.xsz.entity.Administrator;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface AdministratorRepository extends JpaRepository<Administrator,String> {
    public Administrator findByName(String name);

    @Transactional
    @Modifying
    @Query("update User u set u.pwd = ?1 where u.name = ?2")
    public void updatepwd(String pwd, String name);

    @Transactional
    @Modifying
    @Query("update User u set u.role = ?1 where u.id = ?2")
    public int updaterole(Integer role, String id);
}
